package pl.edu.mimuw.irs.core.model.simulation.atomic;

import pl.edu.mimuw.irs.core.global.IDManager;
import pl.edu.mimuw.irs.core.model.design.atomic.DefaultNodeFactory;
import pl.edu.mimuw.irs.core.model.design.net.IRSRequirement;
import pl.edu.mimuw.irs.core.model.petrinet.Place;
import pl.edu.mimuw.irs.core.model.petrinet.Transition;

public class SimulationNodeFactory extends DefaultNodeFactory {

	// *** Constructors
	
	public SimulationNodeFactory(IDManager manager) {
		super(manager);
	}

	// *** Methods

	@Override
	public Place copyPlace(Place place) {
		if (place instanceof IRSRequirement) {
			return new EventPlace(getIdManager(),
					getIdManager().getPrefixedNewId(place.getName()), 
					place.getPosition(), place.getTokens(), 
					(IRSRequirement) place);
		} else {
			return super.copyPlace(place);
		}
	}

	@Override
	public Transition copyTransition(Transition transition) {
		return new EventTransition(getIdManager(),
				getIdManager().getPrefixedNewId(transition.getName()),
				transition.getPosition());
	}
}
